// api/activity.js - 活动相关API
const api = require('../utils/api.js')

/**
 * 获取活动列表
 */
function getActivityList(params = {}) {
  return api.get('/activities', params)
}

/**
 * 获取活动详情
 */
function getActivityDetail(id) {
  return api.get(`/activities/${id}`)
}

/**
 * 创建活动
 */
function createActivity(data) {
  return api.post('/activities', data)
}

/**
 * 更新活动
 */
function updateActivity(id, data) {
  return api.put(`/activities/${id}`, data)
}

/**
 * 删除活动
 */
function deleteActivity(id) {
  return api.del(`/activities/${id}`)
}

/**
 * 搜索活动
 */
function searchActivities(keyword) {
  return api.get('/activities/search', { keyword })
}

/**
 * 获取活动统计
 */
function getActivityStatistics(id) {
  return api.get(`/activities/${id}/statistics`)
}

/**
 * 发布活动
 */
function publishActivity(id) {
  return api.post(`/activities/${id}/publish`)
}

/**
 * 获取全局统计数据
 */
function getStatistics() {
  return api.get('/statistics')
}

module.exports = {
  getActivityList,
  getActivityDetail,
  createActivity,
  updateActivity,
  deleteActivity,
  searchActivities,
  getActivityStatistics,
  publishActivity,
  getStatistics
}

